home *** CD-ROM | disk | FTP | other *** search
Wrap
-------------------------------------------------------------------------------- -- Weapon Steel Bat -- Original Carnage Contest Weapon -- Script by DC, September 2009, www.UnrealSoftware.de -------------------------------------------------------------------------------- -- Setup Tables if cc==nil then cc={} end cc.steelbat={} -- Load & Prepare Ressources cc.steelbat.gfx_wpn=loadgfx("weapons/steelbat.bmp") -- Weapon Image setmidhandle(cc.steelbat.gfx_wpn) cc.steelbat.sfx_attack=loadsfx("throw.ogg") -- Attack Sound cc.steelbat.sfx_steel=loadsfx("buildmetal.ogg") -- Steel Sound -------------------------------------------------------------------------------- -- Weapon: Steel Bat -------------------------------------------------------------------------------- cc.steelbat.id=addweapon("cc.steelbat","Steel Bat",cc.steelbat.gfx_wpn,0) -- Add Weapon (0 uses) function cc.steelbat.draw() -- Draw -- Decrease Timer (used for animation) if weapon_timer>0.0 then weapon_timer=weapon_timer-0.5 end -- Draw if getplayeraction(0)==0 then setblend(blend_alpha) setalpha(1) setcolor(255,255,255) setscale(-getplayerdirection(0),1) setrotation(getplayerrotation(0)-(90-(weapon_timer*3))*(getplayerdirection(0))) drawimage(cc.steelbat.gfx_wpn,getplayerx(0)+getplayerdirection(0)*7,getplayery(0)+3) end -- HUD Crosshair if weapon_shots==0 then hudcrosshair(7,3) end end function cc.steelbat.attack(attack) -- Attack if (weapon_shots<=0) then if (attack==1) then -- No more weapon switching! useweapon(0) playsound(cc.steelbat.sfx_attack) weapon_shots=weapon_shots+1 -- Set timer for animation weapon_timer=30 -- Collision col=0 for dist=5,20,5 do for i=-2,2,1 do if col==0 then if collision(col5x5,getplayerx(0)+getplayerdirection(0)*7+math.sin(math.rad(getplayerrotation(0)+(i*10)))*dist,getplayery(0)+3-math.cos(math.rad(getplayerrotation(0)+(i*10)))*dist,0,1,0)==1 then if playercollision()~=0 and playercollision()~=playercurrent() then playerpush(playercollision(),math.sin(math.rad(getplayerrotation(0)))*25,-math.cos(math.rad(getplayerrotation(0)))*25) playerdamage(playercollision(),50) playsound(sfx_splatter1) playsound(cc.steelbat.sfx_steel) particle(p_ring,getplayerx(playercollision()),getplayery(playercollision())) particlecolor(255,0,0) blood(getplayerx(playercollision()),getplayery(playercollision())) col=1 break end end end end end -- End Turn endturn() end end end